#ifndef CIOPS_OP_CREATECONE_H
#define CIOPS_OP_CREATECONE_H

#include <strstream>

#include "Operation.h"

namespace CIOps {
    /**
     * This class represents the operation of creation of a cone   
     **/
    class OP_CreateCone : public Operation {    

    public:            
        OP_CreateCone (std::vector<CIView::View*>& v);        //Constructor
        virtual ~OP_CreateCone();                             //Destructor

    protected:
        CIGeom::Geometry* cone;                 //A pointer to the cone that will be added in the 3D scene
        CICore::Point topLeft;                  //The cone top left bounding box coordinate
        float height;                           //The cone height  
        float radius;                           //The cone radius

        int stacks;                             //The number of stacks (for the cone subdivision in faces)
        int slices;                             //The number of slices (for the cone subdivision in faces)

        float rotation_x;                       //The cone x axis orientation

        short coneDetail;                       //The cone tessellation detail

        //Methods for Triangles Tessellation of a cone
        void CreateConeWithTriangles (int stacks, int slices, float height, float radius);
        void AddFace (int v1, int v2, int v3);               

    public:            
        //Utility Methods
        virtual int Exec();         //Method called to execute directly the operation
        virtual void Undo();        //Method called to undo the operation
        virtual void Redo();        //Method called to redo the operation

        virtual void MousePressEvent (CIView::View* view, QMouseEvent* e);        //Mouse Pressed event handler
        virtual void MouseReleaseEvent (CIView::View* view, QMouseEvent* e);      //Mouse Released event handler
        virtual void MouseMoveEvent (CIView::View* view, QMouseEvent* e);         //Mouse Moved event handler
        virtual void WheelEvent (CIView::View* view, QWheelEvent* e);             //Wheel event handler
    };
}

#endif /* CIOPS_OP_CREATECONE_H */
